<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>商品管理系统</title>
	<link rel="stylesheet" type="text/css" href="/static/css/login_normalize.css" />
	<link rel="stylesheet" type="text/css" href="/static/css/login_default.css">
	<link rel="stylesheet" type="text/css" href="/static/css/login_styles.css">
</head>
<body>
	<div class="htmleaf-container">
		<header class="htmleaf-header">
			<h1>欢迎使用商品管理系统</h1>
			
		</header>
		<div class="wrapper">
			<div class="container">
				<h1>Welcome</h1>
				
				<form-log class="" >
					<input id="user_name" type="text" placeholder="用户名">
					<input id="password" type="password" placeholder="用户密码">
					<button type="submit" id="login-button"  >登录</button>
				</form-log>
			</div>
			
		
		</div>
	</div>
	
	<script src="/static/js/jquery-2.1.1.min.js"></script>
	<script>
		$('#login-button').click(function (event) {
			var name = $("#user_name").val();
			var pass = $("#password").val();
			$.ajax({
				url: '/user/login',
				sync:false,
				data: {
					account: name,
					pw: pass,
				},
				success: function (data) {
					if (data == 'true-admin') {

						event.preventDefault();
						$('form-log').fadeOut(500);
						$('.wrapper').addClass('form-success');

						setTimeout(function () {
							window.location.href = "/userAdmin";
						}, 1000)
					}else {
						alert('用户名或密码错误~');

					}
				}

			});

		});


	</script>
</body>
</html>